<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>js选择器</title>
</head>
<body>
    <div id="box1">id选择器</div>
    <div class="box2">class选择器</div>
    <div class="box2">class选择器</div>
    <p>p标签选择器</p>
    <p>p标签选择器</p>
    <div>name属性选择器</div>
    <input type="radio" name="sex" value="0" checked /> 男  
    <input type="radio" name="sex" value="1" /> 女

    <select id="select">
        <option value="0">0</option>
        <option value="1">1</option>
        <option value="2">2</option>
    </select>

    <input type="checbox" name="" >
    <script>
        var box1 = document.getElementById('box1');
        console.log(box1);
        var box10 = document.querySelector('#box1');
        console.log(box10);
        var box2 = document.getElementsByClassName('box2')[0];
        console.log(box2);
        var box20 = document.querySelector('.box2');
        console.log(box20);
        var box200 = document.querySelectorAll('.box2');
        console.log(box200);
        var box3 = document.getElementsByTagName('p');
        console.log(box3);
        var box30 = document.querySelector('p');
        console.log(box30);
        var box300 = document.querySelectorAll('p');
        console.log(box300);
        var box4 = document.getElementsByName('sex')[0];
        console.log(box4);
        var box40 = document.querySelector('[name="sex"]');
        console.log(box40);
        var box400 = document.querySelectorAll('[name="sex"]');
        console.log(box400);
 
    </script>
</body>
</html>